﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
namespace OnlineMediaAnalyzer.Models
{
    public class Channel
    {
        public int ID { get; set; }

        [Required(ErrorMessage = "Name is required")]
        [StringLength(32, ErrorMessage = "Title length must be less than 32")]
        public string Name { get; set; }

        [Required(ErrorMessage = "Url is required")]
        [StringLength(128, ErrorMessage = "Url length should be less than 128")]
        public string Url { get; set; }

        public virtual ICollection<Feed> Feeds { get; set; } 

        [StringLength(32)]
        public string Self
        {
            get
            {
                return string.Format(CultureInfo.CurrentCulture,
                    "api/channels/{0}", this.ID);
            }
            set { }
        }
    }
}